package com.ywl.study.transaction.service;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Slf4j
public class DemoService {

    @Autowired
    JdbcTemplate jdbcTemplate;

    @Transactional
    public void createOrder(){
        int a=2/0;
        jdbcTemplate.execute("insert into t_order (name,num,money) values ('测试货品',10,100)");
        log.info("project-demo2中事务执行完毕。。。");
    }

}
